/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', 'Microsoft YaHei', sans-serif;
    background-color: #F5F7FA;
    color: #2C3E50;
    width: 100%;
    min-height: 100vh;
    overflow-x: hidden;
}

/* 顶部区域 */
.header {
    height: 60px;
    background: linear-gradient(135deg, #4A90E2 0%, #5BA0F2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.header-content {
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-icon {
    font-size: 20px;
}

.header-title {
    font-size: 16px;
    font-weight: 600;
    color: white;
}

/* 主要内容区域 */
.main-content {
    padding: 16px;
    min-height: calc(100vh - 60px);
}

/* 区域样式 */
.section {
    margin-bottom: 16px;
}

/* 配置表单 */
.config-form {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.config-form h3 {
    margin-bottom: 16px;
    color: #2C3E50;
    font-size: 16px;
    font-weight: 600;
}

.input-group {
    margin-bottom: 16px;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 500;
    color: #2C3E50;
}

.input-group input {
    width: 100%;
    padding: 12px;
    border: 1px solid #E1E8ED;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.3s ease;
}

.input-group input:focus {
    outline: none;
    border-color: #4A90E2;
    box-shadow: 0 0 0 2px rgba(74, 144, 226, 0.2);
}

/* 输入框和按钮组合 */
.input-with-button {
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
}

.input-with-button input {
    flex: 1;
    margin: 0;
}

.input-with-button .btn-small {
    flex-shrink: 0;
    height: 46px; /* 匹配输入框高度(12px padding * 2 + 22px line-height) */
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    padding: 8px;
}

/* 输入框操作按钮 */
.input-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.input-actions .btn {
    flex: 1;
    padding: 8px 12px;
    font-size: 12px;
}

/* 配置选项 */
.config-options {
    margin-bottom: 20px;
    padding: 16px;
    background: #F8F9FA;
    border-radius: 6px;
    border: 1px solid #E1E8ED;
}

.option-group {
    margin-bottom: 12px;
}

.option-group:last-child {
    margin-bottom: 0;
}

.option-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 14px;
    font-weight: 500;
    color: #2C3E50;
}

.option-group select,
.option-group input[type="number"] {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #E1E8ED;
    border-radius: 4px;
    font-size: 14px;
    background: white;
}

.option-group select:focus,
.option-group input[type="number"]:focus {
    outline: none;
    border-color: #4A90E2;
    box-shadow: 0 0 0 2px rgba(74, 144, 226, 0.2);
}

.option-group input[type="checkbox"] {
    margin-right: 8px;
    transform: scale(1.1);
}

.option-group input[type="checkbox"] + span {
    font-size: 14px;
    color: #2C3E50;
}

/* API服务商配置 */
.api-providers-config {
    margin: 20px 0;
    padding: 16px;
    background: #F8F9FA;
    border-radius: 6px;
    border: 1px solid #E1E8ED;
}

.api-providers-config h4 {
    margin-bottom: 16px;
    color: #2C3E50;
    font-size: 16px;
    font-weight: 600;
}

.provider-config {
    margin-bottom: 20px;
    border: 1px solid #e0e6ed;
    border-radius: 8px;
    padding: 16px;
    background: #f8f9fa;
}

.provider-config h5 {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 12px 0;
    font-weight: 600;
    color: #495057;
}

.provider-icon {
    font-size: 18px;
}

.provider-status {
    margin-left: auto;
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 12px;
    background: #6c757d;
    color: white;
}

.provider-status.configured {
    background: #28a745;
}

.provider-inputs {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.provider-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 8px;
}

.test-status {
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 4px;
    display: inline-block;
    min-width: 60px;
    text-align: center;
}

.test-status.testing {
    background: #ffc107;
    color: #856404;
    animation: pulse 1.5s infinite;
}

.test-status.success {
    background: #d4edda;
    color: #155724;
}

.test-status.error {
    background: #f8d7da;
    color: #721c24;
}

.test-status.info {
    background: #d1ecf1;
    color: #0c5460;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

/* 配置操作按钮 */
.config-actions {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.config-actions .btn {
    flex: 1;
}

/* 配置状态 */
.config-status {
    padding: 12px;
    background: #F8F9FA;
    border-radius: 6px;
    border: 1px solid #E1E8ED;
}

.status-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.status-item:last-child {
    margin-bottom: 0;
}

.status-label {
    font-size: 14px;
    color: #7F8C8D;
}

.status-value {
    font-size: 14px;
    font-weight: 500;
    color: #2C3E50;
}

.status-value.success {
    color: #27AE60;
}

.status-value.error {
    color: #E74C3C;
}

.status-value.warning {
    color: #F39C12;
}

/* 标签页导航 */
.tab-navigation {
    display: flex;
    background: white;
    border-radius: 8px;
    border: 1px solid #E1E8ED;
    margin-bottom: 16px;
    overflow: hidden;
}

.tab-btn {
    flex: 1;
    padding: 12px 16px;
    border: none;
    background: transparent;
    color: #7F8C8D;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    border-right: 1px solid #E1E8ED;
}

.tab-btn:last-of-type {
    border-right: none;
}

.tab-btn.active {
    background: #4A90E2;
    color: white;
}

.tab-btn:not(.active):hover {
    background: #F8F9FA;
    color: #2C3E50;
}

.tab-btn-settings {
    padding: 12px 16px;
    border: none;
    background: transparent;
    color: #7F8C8D;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-left: 1px solid #E1E8ED;
}

.tab-btn-settings:hover {
    background: #F8F9FA;
    color: #2C3E50;
}

/* 标签页内容 */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* 翻译模型选择区域 */
.translate-model-section {
    background: white;
    border-radius: 8px;
    border: 1px solid #E1E8ED;
    padding: 16px;
    margin-bottom: 16px;
}

.model-selection {
    display: grid;
    grid-template-columns: auto 1fr auto;
    grid-template-areas: "label select status";
    gap: 8px;
    align-items: center;
    width: 100%;
}

.model-selection label {
    grid-area: label;
    font-size: 14px;
    font-weight: 500;
    color: #2C3E50;
    white-space: nowrap;
    flex-shrink: 0;
}

.model-selection select {
    grid-area: select;
    padding: 8px 12px;
    border: 1px solid #E1E8ED;
    border-radius: 6px;
    font-size: 14px;
    background: white;
    color: #2C3E50;
    cursor: pointer;
    transition: border-color 0.3s ease;
    min-width: 0; /* 允许收缩 */
    max-width: 100%;
    width: 100%;
    
    /* 处理文本溢出 */
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
}

.model-selection select:focus {
    outline: none;
    border-color: #4A90E2;
    box-shadow: 0 0 0 2px rgba(74, 144, 226, 0.2);
}

/* 下拉框选项样式优化 */
.model-selection select option {
    font-weight: normal;
    padding: 8px 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 280px; /* 限制选项最大宽度 */
}

.model-selection optgroup {
    font-weight: 600;
    color: #2C3E50;
    font-size: 13px;
}

.model-selection optgroup[label*="免费"] {
    color: #27AE60;
}

.model-selection optgroup[label*="付费"] {
    color: #E67E22;
}

/* 翻译模型状态提示 */
.model-status-indicator {
    grid-area: status;
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
    justify-self: end;
}

/* 响应式布局 - 小屏幕优化 */
@media (max-width: 480px) {
    .model-selection {
        grid-template-columns: auto 1fr auto;
        grid-template-areas: "label select status";
        gap: 6px;
        align-items: center;
    }
    
    .model-selection label {
        font-size: 13px;
        justify-self: start;
    }
    
    .model-selection select {
        font-size: 13px;
        padding: 6px 10px;
        min-width: 0;
    }
    
    .model-status-indicator {
        justify-self: end;
    }
    
    .translate-model-section {
        padding: 12px;
    }
}

/* 中等屏幕优化 */
@media (max-width: 360px) {
    .model-selection select {
        font-size: 13px;
        padding: 6px 10px;
    }
    
    .model-selection label {
        font-size: 13px;
    }
}

.model-status-free {
    background: linear-gradient(135deg, #d4edda, #c3e6cb);
    color: #155724;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    border: 1px solid #c3e6cb;
    white-space: nowrap;
    text-align: center;
}

.model-status-paid {
    background: linear-gradient(135deg, #fff3cd, #ffeaa7);
    color: #856404;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    border: 1px solid #ffeaa7;
    white-space: nowrap;
    text-align: center;
}

/* 在小屏幕上优化状态指示器 */
@media (max-width: 480px) {
    .model-status-free,
    .model-status-paid {
        font-size: 12px;
        padding: 6px 12px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 140px;
    }
}

@media (max-width: 360px) {
    .model-status-free,
    .model-status-paid {
        font-size: 11px;
        padding: 4px 8px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 120px;
    }
}

/* 翻译信息显示 */
.translate-info {
    padding: 12px 16px;
    background: #F8F9FA;
    border-top: 1px solid #E1E8ED;
    text-align: center;
}

.current-model-display {
    font-size: 12px;
    color: #7F8C8D;
    font-style: italic;
}

/* 区域头部 */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #E1E8ED;
}

.section-header > div:first-child {
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-icon {
    font-size: 18px;
}

.section-title {
    font-size: 16px;
    font-weight: 600;
    color: #2C3E50;
}

.header-actions {
    display: flex;
    gap: 8px;
}

/* 提示消息 */
.prompt-message {
    text-align: center;
    padding: 20px;
    color: #7F8C8D;
    font-size: 14px;
    background: white;
    border-radius: 8px;
    border: 1px solid #E1E8ED;
}

.prompt-message p {
    margin-bottom: 16px;
}

.prompt-message .btn {
    margin: 0 auto;
}

/* 加载消息 */
.loading-message {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 20px;
    color: #7F8C8D;
    font-size: 14px;
    background: white;
    border-radius: 8px;
    border: 1px solid #E1E8ED;
}

.loading-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #E1E8ED;
    border-top: 2px solid #4A90E2;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 内容区域 */
.content-area {
    background: white;
    border-radius: 8px;
    border: 1px solid #E1E8ED;
    overflow: hidden;
}

.text-group {
    padding: 16px;
    border-bottom: 1px solid #E1E8ED;
}

.text-group:last-child {
    border-bottom: none;
}

.text-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 500;
    color: #2C3E50;
}

.text-display {
    background: #F8F9FA;
    padding: 12px;
    border-radius: 6px;
    font-size: 14px;
    line-height: 1.5;
    color: #2C3E50;
    word-wrap: break-word;
    white-space: pre-wrap;
    min-height: 80px;
    max-height: 200px;
    overflow-y: auto;
}

.text-display.editable {
    border: 1px solid #E1E8ED;
    background: white;
    cursor: text;
    transition: border-color 0.3s ease;
}

.text-display.editable:focus {
    outline: none;
    border-color: #4A90E2;
    box-shadow: 0 0 0 2px rgba(74, 144, 226, 0.2);
}

.text-display.editable:empty:before {
    content: attr(placeholder);
    color: #95A5A6;
    pointer-events: none;
}

.text-display:empty:before {
    content: attr(placeholder);
    color: #95A5A6;
    pointer-events: none;
}

.summary-scroll {
    max-height: 300px;
    overflow-y: auto;
}

/* 操作按钮 */
.action-buttons {
    display: flex;
    gap: 12px;
    padding: 20px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 12px;
    margin: 16px 0;
    border: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

/* 设置界面 */
.settings-content {
    background: white;
    border-radius: 8px;
    border: 1px solid #E1E8ED;
    overflow: hidden;
}

.settings-group {
    padding: 16px;
    border-bottom: 1px solid #E1E8ED;
}

.settings-group:last-child {
    border-bottom: none;
}

.settings-group h4 {
    margin-bottom: 12px;
    color: #2C3E50;
    font-size: 14px;
    font-weight: 600;
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    padding: 8px 0;
}

.setting-item:last-child {
    margin-bottom: 0;
}

.setting-item label {
    font-size: 14px;
    color: #7F8C8D;
}

.setting-item span {
    font-size: 14px;
    font-weight: 500;
    color: #2C3E50;
}

.settings-actions {
    display: flex;
    gap: 8px;
    padding: 16px;
    background: #F8F9FA;
}

.settings-actions .btn {
    flex: 1;
}

/* 按钮样式 */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    position: relative;
    overflow: hidden;
    min-height: 42px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}



.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.btn:active {
    transform: translateY(-1px);
}

.btn-primary {
    background: linear-gradient(135deg, #4A90E2 0%, #357ABD 50%, #1E5F99 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(74, 144, 226, 0.4);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #5BA0F2 0%, #4A90E2 50%, #357ABD 100%);
    box-shadow: 0 6px 20px rgba(74, 144, 226, 0.5);
}

.btn-secondary {
    background: linear-gradient(135deg, #8E9AAF 0%, #6c757d 50%, #495057 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(108, 117, 125, 0.3);
}

.btn-secondary:hover {
    background: linear-gradient(135deg, #9BB0C4 0%, #8E9AAF 50%, #6c757d 100%);
    box-shadow: 0 6px 20px rgba(108, 117, 125, 0.4);
}

.btn-danger {
    background: linear-gradient(135deg, #FF6B6B 0%, #dc3545 50%, #c82333 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.4);
}

.btn-danger:hover {
    background: linear-gradient(135deg, #FF8787 0%, #FF6B6B 50%, #dc3545 100%);
    box-shadow: 0 6px 20px rgba(220, 53, 69, 0.5);
}

/* 功能性按钮颜色 */
.btn-copy {
    background: linear-gradient(135deg, #27AE60 0%, #2ECC71 50%, #58D68D 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(39, 174, 96, 0.4);
}

.btn-copy:hover {
    background: linear-gradient(135deg, #2ECC71 0%, #58D68D 50%, #7DCEA0 100%);
    box-shadow: 0 6px 20px rgba(39, 174, 96, 0.5);
}

.btn-clear {
    background: linear-gradient(135deg, #F39C12 0%, #E67E22 50%, #D35400 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(243, 156, 18, 0.4);
}

.btn-clear:hover {
    background: linear-gradient(135deg, #F7DC6F 0%, #F39C12 50%, #E67E22 100%);
    box-shadow: 0 6px 20px rgba(243, 156, 18, 0.5);
}

/* 按钮图标样式 */
.btn-icon {
    font-size: 16px;
    font-weight: normal;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.2));
    display: inline-block;
    transition: transform 0.2s ease;
}

.btn:hover .btn-icon {
    transform: scale(1.1);
}

.btn-small {
    padding: 8px 16px;
    font-size: 12px;
    min-width: 36px;
    min-height: 36px;
    border-radius: 10px;
}

.btn-test {
    background: linear-gradient(135deg, #27AE60 0%, #28a745 50%, #20c997 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.4);
    font-size: 12px;
    padding: 8px 16px;
    min-height: 36px;
    border-radius: 10px;
}

.btn-test:hover {
    background: linear-gradient(135deg, #2ECC71 0%, #27AE60 50%, #28a745 100%);
    box-shadow: 0 6px 20px rgba(40, 167, 69, 0.5);
}

.btn-test:disabled {
    background: linear-gradient(135deg, #95A5A6 0%, #6c757d 50%, #495057 100%);
    cursor: not-allowed;
    transform: none;
    opacity: 0.6;
    box-shadow: 0 2px 4px rgba(108, 117, 125, 0.2);
}

.btn-test:disabled:hover {
    transform: none;
    box-shadow: 0 2px 4px rgba(108, 117, 125, 0.2);
}

/* 返回按钮区域 */
.back-button {
    margin-top: 16px;
}

/* 错误消息 */
.error-message {
    background: #FF6B6B;
    color: white;
    padding: 12px 16px;
    border-radius: 6px;
    font-size: 14px;
    margin-top: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* 成功消息 */
.success-message {
    background: #27AE60;
    color: white;
    padding: 12px 16px;
    border-radius: 6px;
    font-size: 14px;
    margin-top: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* 响应式设计 */
@media (max-width: 400px) {
    .main-content {
        padding: 12px;
    }
    
    .action-buttons,
    .settings-actions {
        flex-direction: column;
        gap: 10px;
    }
    
    .btn {
        justify-content: center;
        min-height: 44px; /* 确保触摸友好 */
    }
    
    .btn-icon {
        font-size: 18px; /* 在小屏幕上稍微增大图标 */
    }
    
    .config-actions {
        flex-direction: column;
        gap: 10px;
    }
}

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: #F1F1F1;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb {
    background: #C1C1C1;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #A8A8A8;
}

/* 翻译方向显示 */
.translation-direction {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 16px;
    margin: 8px 0;
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border: 1px solid #dee2e6;
    border-radius: 6px;
    font-size: 13px;
    color: #495057;
    font-weight: 500;
    transition: all 0.3s ease;
}

.translation-direction.active {
    background: linear-gradient(135deg, #e3f2fd, #bbdefb);
    border-color: #90caf9;
    color: #1976d2;
    animation: pulse-direction 2s ease-in-out;
}

.direction-arrow {
    font-size: 14px;
    animation: rotate 2s linear infinite;
}

@keyframes rotate {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes pulse-direction {
    0% { transform: scale(1); }
    50% { transform: scale(1.02); }
    100% { transform: scale(1); }
}

/* 模型选择样式增强 */
#translate-model-select {
    /* 自定义下拉箭头 */
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%234A90E2' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 18px;
    padding-right: 40px !important;
    
    /* 增强样式 */
    border: 2px solid #E1E8ED;
    box-shadow: 0 2px 4px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
    
    /* 移除默认外观 */
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

#translate-model-select:hover {
    border-color: #4A90E2;
    box-shadow: 0 4px 8px rgba(74, 144, 226, 0.15);
}

#translate-model-select:focus {
    border-color: #4A90E2;
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.2), 0 4px 8px rgba(74, 144, 226, 0.1);
}

#translate-model-select optgroup {
    font-weight: 600;
    color: #2c3e50;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-bottom: 1px solid #dee2e6;
    padding: 8px 12px;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* 免费模型组样式 */
#translate-model-select optgroup[label*="免费"] {
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    color: #155724;
    border-left: 3px solid #28a745;
}

/* 付费模型组样式 */
#translate-model-select optgroup[label*="付费"] {
    background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
    color: #856404;
    border-left: 3px solid #ffc107;
}

#translate-model-select option {
    font-weight: normal;
    padding: 10px 16px;
    color: #495057;
    font-size: 13px;
    line-height: 1.4;
    background-color: white;
    border: none;
    transition: all 0.2s ease;
    /* 确保长文本正确显示 */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#translate-model-select option:hover {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    color: white;
    transform: translateX(2px);
}

#translate-model-select option:checked,
#translate-model-select option:selected {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%) !important;
    color: white !important;
    font-weight: 600;
    border-left: 4px solid #155724;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.2);
}

/* 免费模型选项样式 */
#translate-model-select option[value*="free"],
#translate-model-select option[value*="lite"] {
    color: #155724;
    background: linear-gradient(135deg, #f8fff9 0%, #e8f5e8 100%);
    border-left: 2px solid #28a745;
}

#translate-model-select option[value*="free"]:hover,
#translate-model-select option[value*="lite"]:hover {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    border-left: 4px solid #155724;
}

/* 付费模型选项样式 */
#translate-model-select option[value*="moonshot-v1"],
#translate-model-select option[value*="gpt"],
#translate-model-select option[value*="claude"] {
    color: #856404;
    background: linear-gradient(135deg, #fffbf0 0%, #fff3cd 100%);
    border-left: 2px solid #ffc107;
}

#translate-model-select option[value*="moonshot-v1"]:hover,
#translate-model-select option[value*="gpt"]:hover,
#translate-model-select option[value*="claude"]:hover {
    background: linear-gradient(135deg, #ffc107 0%, #e0a800 100%);
    color: white;
    border-left: 4px solid #856404;
}

/* 在移动设备上优化下拉框 */
@media (max-width: 480px) {
    #translate-model-select optgroup {
        font-size: 11px;
        padding: 6px 12px;
        text-transform: none;
        letter-spacing: normal;
    }
    
    #translate-model-select option {
        font-size: 14px;
        padding: 12px 16px;
        /* 在小屏幕上允许文本换行 */
        white-space: normal;
        height: auto;
        min-height: 44px;
        border-left-width: 2px;
    }
    
    #translate-model-select option:hover {
        transform: none; /* 移动设备上不使用transform效果 */
    }
    
    #translate-model-select option:checked,
    #translate-model-select option:selected {
        border-left-width: 3px;
    }
}

/* 超小屏幕优化 */
@media (max-width: 320px) {
    #translate-model-select optgroup {
        font-size: 10px;
        padding: 4px 8px;
    }
    
    #translate-model-select option {
        font-size: 13px;
        padding: 10px 12px;
        min-height: 40px;
    }
}

/* 模型状态标签样式 */
.model-status {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
    margin-left: 8px;
}

.model-status.free {
    background-color: #d4edda;
    color: #155724;
}

.model-status.paid {
    background-color: #f8d7da;
    color: #721c24;
}

/* 频率限制警告样式 */
.rate-limit-error {
    background: linear-gradient(135deg, #fff3cd 0%, #ffeeba 100%);
    border: 2px solid #ffc107;
    border-radius: 12px;
    color: #856404;
    margin: 15px 0;
    animation: slideInDown 0.5s ease-out;
}

.rate-limit-warning {
    padding: 20px;
}

.rate-limit-warning h4 {
    margin: 0 0 12px 0;
    font-size: 16px;
    font-weight: 600;
    color: #856404;
    display: flex;
    align-items: center;
    gap: 8px;
}

.rate-limit-warning p {
    margin: 0 0 15px 0;
    line-height: 1.5;
    color: #6c5700;
}

.countdown-info {
    background: rgba(255, 193, 7, 0.1);
    border: 1px solid #ffc107;
    border-radius: 8px;
    padding: 12px;
    margin: 15px 0;
    text-align: center;
}

.countdown-info span {
    font-size: 14px;
    color: #6c5700;
}

#countdown-timer {
    color: #dc3545;
    font-weight: bold;
    font-size: 18px;
    background: rgba(220, 53, 69, 0.1);
    padding: 2px 8px;
    border-radius: 4px;
    animation: pulse 1s infinite;
}

.rate-limit-tips {
    margin-top: 15px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 8px;
    padding: 15px;
}

.rate-limit-tips p {
    margin: 0 0 10px 0;
    font-weight: 600;
    color: #856404;
}

.rate-limit-tips ul {
    margin: 0;
    padding-left: 20px;
    list-style-type: disc;
}

.rate-limit-tips li {
    margin: 8px 0;
    line-height: 1.4;
    color: #6c5700;
    font-size: 13px;
}

/* 动画效果 */
@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

/* 按钮禁用状态样式 */
button:disabled {
    background: linear-gradient(135deg, #95A5A6 0%, #6c757d 50%, #495057 100%) !important;
    cursor: not-allowed !important;
    opacity: 0.6;
    box-shadow: 0 2px 4px rgba(108, 117, 125, 0.2) !important;
    transform: none !important;
}

button:disabled:hover {
    background: linear-gradient(135deg, #95A5A6 0%, #6c757d 50%, #495057 100%) !important;
    transform: none !important;
    box-shadow: 0 2px 4px rgba(108, 117, 125, 0.2) !important;
}

.btn:disabled {
    background: linear-gradient(135deg, #95A5A6 0%, #6c757d 50%, #495057 100%) !important;
    cursor: not-allowed !important;
    opacity: 0.6;
    box-shadow: 0 2px 4px rgba(108, 117, 125, 0.2) !important;
    transform: none !important;
}

.btn:disabled:hover {
    background: linear-gradient(135deg, #95A5A6 0%, #6c757d 50%, #495057 100%) !important;
    transform: none !important;
    box-shadow: 0 2px 4px rgba(108, 117, 125, 0.2) !important;
}



.btn:disabled .btn-icon {
    filter: grayscale(100%) opacity(0.6);
    transform: none !important;
}

.btn-copy:disabled {
    background: linear-gradient(135deg, #95A5A6 0%, #6c757d 50%, #495057 100%) !important;
    box-shadow: 0 2px 4px rgba(108, 117, 125, 0.2) !important;
}

.btn-clear:disabled {
    background: linear-gradient(135deg, #95A5A6 0%, #6c757d 50%, #495057 100%) !important;
    box-shadow: 0 2px 4px rgba(108, 117, 125, 0.2) !important;
}

/* 加载状态的输入框样式 */
textarea.loading {
    background: linear-gradient(90deg, #f8f9fa 25%, #e9ecef 50%, #f8f9fa 75%);
    background-size: 200% 100%;
    animation: loading-shimmer 1.5s infinite;
}

@keyframes loading-shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

/* 更全面的响应式布局优化 */
@media (max-width: 320px) {
    /* 超小屏幕优化 */
    .main-content {
        padding: 8px;
    }
    
    .translate-model-section {
        padding: 8px;
        margin-bottom: 8px;
    }
    
    .model-selection {
        grid-template-columns: auto 1fr auto;
        grid-template-areas: "label select status";
        gap: 4px;
        align-items: center;
    }
    
    .model-selection label {
        font-size: 12px;
    }
    
    .model-selection select {
        font-size: 12px;
        padding: 6px 28px 6px 8px;
        min-width: 0;
    }
    
    .model-status-indicator {
        justify-self: end;
    }
    
    .model-status-free,
    .model-status-paid {
        font-size: 10px;
        padding: 2px 4px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 60px;
    }
    
    #translate-model-select {
        background-size: 16px;
        background-position: right 8px center;
        padding-right: 32px !important;
        border-width: 1px;
        box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    }
    
    #translate-model-select:hover {
        box-shadow: 0 2px 6px rgba(74, 144, 226, 0.15);
    }
    
    #translate-model-select:focus {
        box-shadow: 0 0 0 2px rgba(74, 144, 226, 0.2), 0 2px 6px rgba(74, 144, 226, 0.1);
    }
    
    #translate-model-select option {
        font-size: 12px;
        padding: 8px 8px;
    }
    
    #translate-model-select optgroup {
        font-size: 11px;
        padding: 4px 8px;
    }
}

/* 横屏模式优化 */
@media (orientation: landscape) and (max-height: 500px) {
    .translate-model-section {
        padding: 8px 12px;
    }
    
    .model-selection {
        grid-template-columns: auto 1fr auto;
        grid-template-areas: "label select status";
        gap: 6px;
        align-items: center;
    }
    
    .model-selection label {
        font-size: 13px;
    }
    
    .model-selection select {
        font-size: 13px;
        padding: 4px 8px;
        min-width: 0;
    }
    
    .model-status-indicator {
        justify-self: end;
    }
    
    .model-status-free,
    .model-status-paid {
        font-size: 10px;
        padding: 2px 4px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 80px;
    }
}

/* 高分辨率屏幕优化 */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    #translate-model-select {
        background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23495057' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
    }
}

/* 触摸设备优化 */
@media (pointer: coarse) {
    .model-selection select {
        min-height: 44px; /* 确保足够的触摸目标大小 */
    }
    
    #translate-model-select option {
        min-height: 44px;
        display: flex;
        align-items: center;
    }
}

/* 暗色主题适配 */
@media (prefers-color-scheme: dark) {
    #translate-model-select {
        background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
    }
}

/* 减少动画效果（用户偏好） */
@media (prefers-reduced-motion: reduce) {
    .model-selection select,
    .model-status-free,
    .model-status-paid {
        transition: none;
    }
} 